package com.dx.mes.common.dao.impl;

import com.dx.common.table.ppt.Ret_stocker_zn;
import com.dx.common.table.ppt.Ret_stocker_znId;
import com.dx.mes.common.core.dao.impl.GenericHibernateDao;
import com.dx.mes.common.dao.IRetStockerZnDao;
import org.springframework.stereotype.Repository;


@Repository
public class RetStockerZnHibernateDao extends GenericHibernateDao<Ret_stocker_zn, Ret_stocker_znId> implements IRetStockerZnDao {
	
/*	public List<StockerZoneBeen> comStkInSumZoneInCrr(String stocker_id, List<Ret_box_xfr> box_xfrList){
		List<StockerZoneBeen> stkZoneList = new ArrayList<StockerZoneBeen>();
		//获取Stocker Zone设定
		String hql_stocker_zn = "FROM Ret_stocker_zn WHERE stocker_id_fk='" + stocker_id + "'";
		List<Ret_stocker_zn> stocker_znList = this.find(hql_stocker_zn);
			
		for(Ret_stocker_zn sorcker_zn:stocker_znList){
			StockerZoneBeen stkZone = new StockerZoneBeen();
			Integer zone_use_cnt = 0;
			stkZone.setZone_id(sorcker_zn.getId().getZone_id());
			stkZone.setZone_dsc(sorcker_zn.getZone_dsc());
			stkZone.setZone_std_qty(sorcker_zn.getZone_std_qty()!=null ? sorcker_zn.getZone_std_qty() : 0);
			//统计in zone count
			for(Ret_box_xfr box_xfr:box_xfrList){
				if(RTD_XFR_CMD_FLG_STI.equals(box_xfr.getXfr_cmd_flg())){
					if(sorcker_zn.getId().getStocker_id_fk().equals(box_xfr.getXfr_pos_id()) &&
							sorcker_zn.getId().getZone_id().equals(box_xfr.getXfr_zone_id())){
						zone_use_cnt ++;
					}
				}else if(RTD_XFR_CMD_FLG_SXS.equals(box_xfr.getXfr_cmd_flg()) ||
						RTD_XFR_CMD_FLG_TXT.equals(box_xfr.getXfr_cmd_flg())){
					if(sorcker_zn.getId().getStocker_id_fk().equals(box_xfr.getXfr_pos_id()) && 
							sorcker_zn.getId().getZone_id().equals(box_xfr.getXfr_zone_id())){
						zone_use_cnt ++;
					}else if(sorcker_zn.getId().getStocker_id_fk().equals(box_xfr.getXfr_to_tool_id()) && 
							sorcker_zn.getId().getZone_id().equals(box_xfr.getXfr_to_zone_id())){
						zone_use_cnt ++;
					}
				}
			}
			stkZone.setZone_use_qty(zone_use_cnt);
			stkZoneList.add(stkZone);
		}
		return stkZoneList;
	}*/
}
